﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HBase{
    public class UtilByteArr {

        public static int append(byte[] a, int begin, byte[] b) {//返回有效长度
            return copy(a, begin, b, 0, b.Length);
        }

        static public int copy(byte[] a, int begin, byte[] b, int f, int len) {//返回有效长度 
            if (a.Length < begin + len) {
                throw new Exception("长度异常");
            }
            if (len == 0) {
                return begin;
            }
            int index = 0;
            for (int i = f; i < f + len; i++) {
                index = begin + i - f;
                a[index] = b[i];
            }
            return index + 1;
        }

       

        public static byte[] cut(byte[] b, int f, int len) {
            byte[] r=new byte[len];
            for (int i = 0; i < len; i++) {
                r[i] = b[i+f];
            }
            return r;
        }
    }
}
